/*	
   ______   ______    
  /\__  __\/\ \___\ 
  \/_/\ \_/\ \ \__/    __   __     __       
     \ \ \  \ \ \__\  /\ \ /\ \  /'__`\  
     _\_\ \  \ \ \_/_ \ \ \\_\ \/\  __/       
    /\____/   \ \_____\\ \_____/\ \____\   
    \_/__/     \/_____/ \/____/  \/____/                   
 
 	This file is part of the JEVE core API.

    JEve is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    JEve is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    Copyright 2008 JEve Project (JEveProject@gmail.com)
 */
package be.fomp.jeve.core.config;

import be.fomp.jeve.core.exceptions.JEveConfigurationException;
import be.fomp.jeve.core.util.Proxy;
import java.net.Proxy.Type;
import java.util.Properties;

/**
 * <pre>
 *  ______   ______    
 * /\__  __\/\ \___\ 
 * \/_/\ \_/\ \ \__/    __   __     __       
 *    \ \ \  \ \ \__\  /\ \ /\ \  /'__`\  
 *    _\_\ \  \ \ \_/_ \ \ \\_\ \/\  __/       
 *   /\____/   \ \_____\\ \_____/\ \____\   
 *   \_/__/     \/_____/ \/____/  \/____/                   
 *</pre>
 *	This file is part of the JEVE core API.<br />
 *	<br />
 * 
 * Interface containing the core configuration file location and parameters for JEve-Core.
 * 
 * @author Sven Meys
 *
 */
public interface CoreConfiguration extends JEveConfiguration {
	/**
	 * File where all configuration options are saved
	 */
	static final String CONFIG_FILE_NAME = "conf/core.configuration";

	/**
	 * Only one core configuration file, so only one properties object needed.
	 * If the properties are updated anywhere, all instances of this class will have the same properties.
	 */
	public static final Properties CORE_PROPERTIES = new Properties();
	
	// Parameter keys inside the config file
	static final String USE_PROXY = "useProxy";
	static final String PROXY_TYPE = "proxyType";
	static final String PROXY_HOST = "proxyHost";
	static final String PROXY_PORT = "proxyPort";
	static final String PROXY_AUTH = "useProxyAuth";
	static final String PROXY_USER = "proxyUser";
	static final String PROXY_PASS = "proxyPass";
	
	// Default parameter values inside the config file
	static final String DEFAULT_USE_PROXY = "false";
	static final String DEFAULT_PROXY_TYPE = "DIRECT";
	static final String DEFAULT_PROXY_HOST = "";
	static final String DEFAULT_PROXY_PORT = "80";
	static final String DEFAULT_PROXY_AUTH = "false";
	static final String DEFAULT_PROXY_USER = "";
	static final String DEFAULT_PROXY_PASS = "";

	/**
	 * Fetches the proxy configuration options from the config file
	 * and returns it as a Proxy Object.
	 *
	 * When useProxy is false null will be returned. When this happens the JVM default settings
	 * are used when trying to connect to the internet.
	 * Any invalid setting detected will be set to the default defined in the <a>CoreConfiguration</a> interface
	 * @return An object containing the proxy settings
	 */
	public Proxy getProxyConfiguration();
	
	/**
	 * Sets the proxy configuration parameters in the properties.
	 * When either one of the settings are invalid, they will be replaced by the default values.
	 *
	 * @param useProxy	 true|false whether a proxy is defined
	 * @param proxyType	DIRECT|HTTP|SOCKS defines the proxy type
	 * @param proxyHost	the proxy host
	 * @param proxyPort	the proxy port
	 * @param useProxyAuth true|false defines whether authentication is used
	 * @param proxyUser	the proxy username
	 * @param proxyPass	the proxy password
	 * @throws JEveConfigurationException When loading the configuration failed
	 */
	void setProxyconfiguration(boolean useProxy,
							   Type proxyType,
							   String proxyHost,
							   int proxyPort,
							   boolean useProxyAuth,
							   String proxyUser,
							   String proxyPass) throws JEveConfigurationException;
}
